package com.hjxr.quota.define.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hjxr.quota.define.domain.QuotaValue;
import com.hjxr.quota.define.dto.QuotaAndValueVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @author ma
 * @version v1.0
 * @date 2020/9/17
 **/
public interface QuotaValueMapper extends BaseMapper<QuotaValue> {
    /**
     * 计算指标值
     *
     * @param parms     where条件（key=value）
     * @param tableName 表名
     * @return
     */
    List<Float> computeValueF(@Param("condition") Map<String, Object> parms, @Param("tableName") String tableName, @Param("fieldName") String fieldName);

    List<Double> computeValueD(@Param("condition") Map<String, Object> parms, @Param("tableName") String tableName);

    List<Integer> computeValueI(@Param("condition") Map<String, Object> parms, @Param("tableName") String tableName);

    List<QuotaAndValueVo> selectQuotaAndValue(@Param("themeIds") List<Integer>themeIds, @Param("quotaIds") List<Integer> quotaIds,
                                              @Param("rowCount") Integer rowCount, @Param("offSet") Integer offSet);
    Integer selectQuotaAndValueCount(@Param("themeIds") List<Integer>themeIds,@Param("quotaIds") List<Integer> quotaIds,
                                              @Param("rowCount") Integer rowCount, @Param("offSet") Integer offSet);

    List<Map<String, Object>> selectQuotaValue(Integer quotaId);

    int batchInsertValue(List<QuotaValue>values);

}
